﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace SynchronizedPlayer
{
	/// <summary>
	/// Interaction logic for App.xaml
	/// </summary>
	public partial class App : Application
	{
		public App() {
			Command.BuildDictionary();

			Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
			KeyValueConfigurationCollection settings = config.AppSettings.Settings;

			if (!config.AppSettings.Settings.AllKeys.Contains<string>("IP")) {
				config.AppSettings.Settings.Add("IP", "192.168.1.1");
			}

			if (!config.AppSettings.Settings.AllKeys.Contains<string>("Port")) {
				config.AppSettings.Settings.Add("Port", "23232");
			}

			if (!config.AppSettings.Settings.AllKeys.Contains<string>("MediaFolder")) {
				config.AppSettings.Settings.Add("MediaFolder", "C:\\Music");
			}

			config.Save(ConfigurationSaveMode.Modified);
			ConfigurationManager.RefreshSection("appSettings");
		}
	}
}
